package com.online.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.online.entity.ExamManage;
import com.online.mapper.ExamManageMapper;
import com.online.service.ExamManageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


@Service
public class ExamManageServiceImpl  implements ExamManageService {
    @Autowired
    private ExamManageMapper  examManageMapper;

    /**
     * 分页查询所有试卷
     * @param examManagePage
     * @return
     */
    @Override
    public IPage<ExamManage> findAll(Page<ExamManage> examManagePage) {
        return examManageMapper.findAll(examManagePage);
    }

    /**
     * 根据id查找考试
     * @param examCode
     * @return
     */
    @Override
    public ExamManage findById(Integer examCode) {
        return examManageMapper.findById(examCode);
    }

    /**
     * 根据ID删除考试
     * @param examCode
     * @return
     */

    @Override
    public int deleteById(Integer examCode) {
        return examManageMapper.deleteById(examCode);
    }

    /**
     * 更新考试信息
     * @param examManage
     * @return
     */
    @Override
    public int update(ExamManage examManage) {
        return examManageMapper.update(examManage);
    }

    /**
     * 增加考试
     * @param examManage
     * @return
     */
    @Override
    public int add(ExamManage examManage) {
        return examManageMapper.add(examManage);
    }

    /**
     * 查询最后一条记录的paperId,返回给前端达到自增效果
     * @return
     */
    @Override
    public ExamManage findOnlyPaperId() {
        return examManageMapper.findOnlyPaperId();
    }
}
